s=list(map(int,input().split()))
count=0
for i in range(s[0],s[1]+1):
    j=str(i)
    for x in j:
        if x=='2':
            count+=1
print(count)